package com.lagou.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @ClassName: VertifyCodeClient
 * @Auther: Jerry
 * @Date: 2020/10/22 16:49
 * @Desctiption: VertifyCodeClient接口
 * @Version: 1.0
 */
@FeignClient(value = "lagou-service-code", path = "/code",fallback = VerifyCodeFallback.class)
public interface VerifyCodeClient {

    /**
     * 生成验证码并发送到对应邮箱，成功true，失败false
     * @param email 电子邮件
     * @return {@link Boolean}
     */
    @RequestMapping("/create/{email}")
    Boolean create(@PathVariable("email") String email);

    /**
     * 校验验证码是否正确，0正确1错误2超时
     * @param email 电子邮件
     * @param code 代码
     * @return {@link Integer}
     */
    @RequestMapping("/validate/{email}/{code}")
    Integer validate(@PathVariable("email") String email, @PathVariable("code") String code);
}
